package com.an.redisl;

import java.util.Map;

import com.an.jackjson.CacheKeyUtil;
import com.an.json.PhoneNumber;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;

import redis.clients.jedis.Jedis;

public class test5 {

	@SuppressWarnings("unchecked")
	public static void main(String[] args) {
		CacheKeyUtil cacheKeyUtil = new CacheKeyUtil();
		ObjectMapper objectMapper = new ObjectMapper();
		// json字符串中可以有vo中没有的字段
		objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
		PhoneNumber phoneNumber = new PhoneNumber();

		String number = "13605750000";
		phoneNumber.setAreaCode("0571");
		phoneNumber.setPhoneNumber(number);
		phoneNumber.setPhoneNumberType(PhoneNumber.PHONE_NUMBER_TYPE_Y);
		phoneNumber.setServiceCode(PhoneNumber.SERVICE_CODE_AXYB);
		phoneNumber.setProvinceCode("浙江---AXYB---Y");
		phoneNumber.setCustomerId("86af8f8215b54dac8641e72dd226ab5f");
		phoneNumber.setImsi("imsi--00");
		phoneNumber.setSmsCenterNumber("+86");

		Map<String, String> map;
		try {
			map = objectMapper.readValue(objectMapper.writeValueAsString(phoneNumber), Map.class);
			// 绑定X号码
			map.remove("binding");
			map.remove("axbBindingPhoneNumberMap");
			// X号码绑定A号码

			Jedis jedis = new Jedis("10.8.22.18");
			jedis.auth("AS@redis");
			jedis.hmset(cacheKeyUtil.getPhoneNumberKey(number), map);
			jedis.hset(cacheKeyUtil.getCustomerPhoneNumberKey("86af8f8215b54dac8641e72dd226ab5f"), number,
					PhoneNumber.PHONE_NUMBER_TYPE_Y);
		} catch (Exception e) {
		}
	}

	// 增加Y号码

}
